/**
 * 版权所有（c）2021. 上海海鼎信息工程股份有限公司，保留所有权利
 */
package com.lovely602.design.behavior.interpreter.demo;

/**
 * 非终结符表达式类
 *
 * @author lizhixing
 */
public class AndExpression implements Expression {
  private Expression city = null;
  private Expression person = null;

  public AndExpression(Expression city, Expression person) {
    this.city = city;
    this.person = person;
  }

  @Override
  public boolean interpret(String info) {
    String s[] = info.split("的");
    return city.interpret(s[0]) && person.interpret(s[1]);
  }
}
